<%@page contentType="text/html; charset=UTF-8"%>
 <%@ page import="net.jdiy.core.*" %>
<%@page import="java.util.HashMap"%>
<%@page import="java.util.Map"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd"><html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>JDiy-2.1</title>
<link href="../JDiy_bin/img/public.css" rel="stylesheet" type="text/css" />
<link href="../JDiy_bin/skins/white/css_right.css" rel="stylesheet" type="text/css" />
<link rel="Bookmark" href="../JDiy_bin/img/favicon.ico" /><link rel="Shortcut Icon" href="../JDiy_bin/img/favicon.ico" />
<script type="text/ecmascript" src="../JDiy_bin/js/class/JSer.js"></script>
<script type="text/javascript" src="../JDiy_bin/js/class/jc.js"></script>
<script type="text/javascript" src="../JDiy_bin/js/evt/ee.js"></script>
<script type="text/ecmascript" src="../JDiy_bin/js/class/md5.js"></script>
<script type="text/ecmascript" src="../JDiy_bin/js/class/JSer.select.js"></script>
<script type="text/javascript">jde_root='/jdiy/JDiy_bin/jde/';jde_upp='/jdiy/jdiy-admin/~.jd?~=';</script>
<script type="text/ecmascript" src="../JDiy_bin/jde/editor_config.js"></script>
<script type="text/ecmascript" src="../JDiy_bin/jde/editor_all_min.js"></script>
<script type="text/ecmascript" src="../JDiy_bin/js/my97/WdatePicker.js"></script>
<script type="text/ecmascript" src="../JDiy_bin/js/evt/in.js"></script>

<style type="text/css">
.fd th{text-align:center;}
.fd td{background-color:white;}
.fd select{width:110px;height:100px;}
.mbtn{width:32px;}
.ztin{width:68px;}
.password{width:88px;}
.chn {font-weight: bold;margin-top: 10px;}
.mm {color: #003366;padding-left: 27px;}
.nob td{border-bottom:none!important;border-right:none!important;}
.JSer-Keditor{width:100%;height:300px;}</style>
</head>
<%
App app = App.get();//取得JDiy App上下文
Dao dao = app.getDao(); //取得默认的数据库操作DAO对象(DataAccessObject)
Rs role = null;
Map roleSet = new HashMap();
if("edit".equals(app.get("opt")))
{
	String currid = app.get("id");
	if(!"".equals(currid)&&currid!=null)
	{
		role= dao.rs(new Args("jdiy_sys", "id='"+currid+"'"));
		String[] roleStrings = role.get("t15").split(",");
		for(String s:roleStrings)
		{
			System.out.println(s.replaceAll("'", "").replaceAll(" ", ""));
			//roleSet.add(s.replaceAll("'", ""));
			roleSet.put(s.replaceAll("'", "").replaceAll(" ", ""), "checked");
		}
	}
}
%>
<body>

<table border="0" cellpadding="0" cellspacing="0" class="Max">
<tr><td><table width="100%" border="0" cellpadding="0" cellspacing="0" class="cTit">
<tr><td class="L">&nbsp;</td>
<td class="C">:::::: 
前端角色<%if(role==null){out.println("添加");}else{out.println("修改");} %> ::::::</td>
<td class="R">&nbsp;</td>
</tr></table></td></tr><tr><td><form action="~.jd?~=doSave@Update&_=0.8113531694221734" method="post" id="zltForm" name="zltForm" enctype="multipart/form-data">
<table width="100%" border="0" cellpadding="3" cellspacing="0" class="TB">
<tr class="C"><th nowrap="nowrap">排序索引：</th><td colspan="3">
<input name="sort" id="sort" type="text" maxlength="127" class="in" value="<%if(role!=null)out.print(role.get("sort") );%>"  />
<input name="t2" id="t2" type="hidden"  value="0"  />
<span class="txtC">  </span>
</td></tr>
<tr class="C"><th nowrap="nowrap" width="8%">角色名称：</th><td colspan="3">
<input name="t0" id="t0" type="text" maxlength="127" class="in" value="<%if(role!=null)out.print(role.get("t0") );%>"  />

<span class="txtC">  </span>
</td></tr>

<tr class="C"><th nowrap="nowrap" width="8%">简要备注：</th><td colspan="3">
<input name="t1" id="t1" type="text" maxlength="127" class="in" value="<%if(role!=null)out.print(role.get("t1") );%>" style="width:99%;" />

<span class="txtC">  </span>
</td></tr>

<tr class="C"><th nowrap="nowrap" width="8%">操作权限：</th>
<td colspan="3">


<script type="text/ecmascript" src="../JDiy_bin/js/evt/role.js"></script>

<%
Ls ls= dao.ls("SELECT t0,id,tid,t1 FROM front_menu WHERE tid='0000000000' and t1 is null", 0, 1);
for(Rs rs:ls.getItems()){
String pid=rs.get("id");
String pname=rs.get("t0");

%>

<div class="chn"><label><input name="roles" type="checkbox" class="inChk" value="<%=pid %>" zlt="chn"  <%=roleSet.get(pid)%>/><%=pname %></label></div>



<table border="0" class="nob">
<% 
Ls ls1= dao.ls("SELECT t0,id,tid,t1 FROM front_menu WHERE tid='"+pid+"' and t1 is null", 0, 1);
for(Rs rs1:ls1.getItems())
{
String pid1 =rs1.get("id");
String pname1 =rs1.get("t0");

%>
<tr>
<td valign="top" class="mm" nowrap><label><input name="roles" type="checkbox" class="inChk" chnid="<%=pid %>" value="<%=pid1 %>" zlt="mm"  <%=roleSet.get(pid1)%>/><%=pname1%></label></td>
<td class="txtC">&gt;&gt;</td><td>
<%
Ls ls2= dao.ls("SELECT t0,id,tid,t1 FROM front_menu WHERE tid='0000000000' and t1='"+pid1+"'", 0, 1);
for(Rs rs2:ls2.getItems())
{
	String pid2=rs2.get("id");
	String pname2=rs2.get("t0");

%>
<nobr><label class="sm"><input name="roles" type="checkbox" class="inChk" zlt="sm" value="<%=pid2 %>" chnid="<%=pid %>" mmid="<%=pid2 %>"  <%=roleSet.get(pid2)%>/><%=pname2 %></label></nobr>
<%} %>
</td>
</tr>
<%} %>
</table>



<%} %>



</td>
</tr>

<tr class="C"><th>&nbsp;</th><td colspan="3"><div id="upControl"><input id="btnOk" type="submit" class="btn" value=" 确 定 添 加 " />　<input id="btnReset" type="button" class="btn" value=" 重置 " href="" /></div><div style="display:none;padding:2px;margin:3px;" class="txtA" id="upLoading">请稍等，正在向服务器提交数据......

<div id="loadingBar" style="display:none"><table><tr><td><table cellpadding="0" cellspacing="1" border="0" style="border:1px #000 solid;background-color:#eee;width:304px;font-size:0px;line-height:0px;"><tr><td style="padding:0px;"><img id="upProcessBar" src="../JDiy_bin/img/pst.gif" style="margin:0px;border:0px;height:12px;width:1px;" align="absmiddle;"></td></tr></table></td><td style="font-weight:bold;color:#03f" id="upPercent">0%</td></tr></table><span id="upByteInfo" style="color:#03f">&nbsp;</span></div>

<div style="font-weight:bold;">请不要刷新或跳转到其它页面！</div>
</div>
<input type="hidden" name="isc" id="isc" value="1" />
<input name="tid" id="tid" value="z0000000s0" type="hidden" />
<input type="hidden" name="t15" id="t15" value="" />

<input name="__JDiy_Table__" id="__JDiy_Table__" type="hidden" value="a3150db666dbb605e285ad83d874b27c" />
<input name="__JDiy_Pk__" id="__JDiy_Pk__" type="hidden" value="510b4510b734f5c50b5be54b650fb8a8" />
<input name="__JDiy_Id__" id="__JDiy_Id__" type="hidden" value="e93b44c921d74c04fbf43eb12dab2e5c" />
<input name="__JDiy_Ref__" id="__JDiy_Ref__" type="hidden" value="8c1f2ac0911b1f454c29987e464d16c0434f53a7421b296e14c542f9a8e0a855" />
<input name="__JDiy_Sign__" id="__JDiy_Sign__" type="hidden" value="67EA02C7B6AA9754F9D8E8AF871DF71F" />
<input name="__JDiy_Jump__" id="__JDiy_Jump__" type="hidden" value="" />
<script type="text/ecmascript">document.getElementById("__JDiy_Jump__").value=document.location.href;</script>
<input name="dt1" id="dt1" value="2013-05-20 15:08:52" type="hidden" />
<input name="dt2" id="dt2" value="2013-05-20 15:08:52" type="hidden" />

</td></tr></table></form></td></tr><tr><td><script type="text/ecmascript">
var isNoRepeat=true;
JSer.exec(function(){
JSer("#zltForm").submit(function(){
   var fm=new jc.Form(this);
   if(fm.isNull('tid','未指定『上级栏目』'))return false;
   fm.setDef('sort',100);
   if(!fm.isInt('sort','排序索引必须是一个不小于０的整数数字')) return false;
try{




setRoles();
if(JSer('#t15').val()==''){alert('您还没有给该角色设置权限!');return false;}

if(fm.isRepeat({by:'tid', root:''})) return false;
}catch(e){
alert('对不起,脚本验证出错,请联系开发人员解决此问题！\r\n错误信息：'+e);return false;
}
showLoadingBar();JSer('#upControl').hide();JSer('#upLoading').show();
});

});
</script></td></tr></table><br /><div style="text-align:center;font-size:10px">Copyright&copy; <strong style="color:#040;cursor:pointer" onclick="parent.JD_Dialog({tit:'关于...',width:444,height:260,href:'~.jd?~=about@Base'});" title="关于 JDiy"><i>JDiy-2.1</i></strong></div>
</body></html>


<!--**********************************************************************

                      ★ JDiy建站平台 ★　

　版权所有：　                                        
　              JDiy网页编程技术站 http://jdiy.net 
                 ====================================
　CopyRight (C)
                                                          
 【全程开发】：  郑连涛（网上昵称：子秋、Folier   QQ:39886616）

***********************************************************************-->
